home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / zkf102.zip / link.txt < prev    next >
Text File  |  1995-01-04  |  4KB  |  68 lines

  1.         How to link your code and zk together to make a new zk.exe
  2.  
  3.  
  4. Note: The features described in this document are only supported by the
  5. pro version of zk.
  6.  
  7. This document describes how to link your code and zk together to make
  8. a new zk.  The advantage of doing so is that you can then call your
  9. compiled functions from the interpreted code you input to zk.  That
  10. lets your compiled functions run at full compiled speed instead of
  11. interpreted speed.  Compiled code is a lot faster than interpreted
  12. code, especially when it involves loops with large numbers of
  13. iterations.
  14.  
  15. You may ask why bother to use an interpreter at all if compiled code
  16. is so much faster.  The advantage of interpreted code is that you don't
  17. have to wait for it to compile before you use it.  You can type in
  18. command lines and see them execute immediately.  Thus, an interpreter
  19. supports exploratory programming, which you do when you are starting to
  20. test your ideas for a new program design, but before you get into the
  21. formal design phase.  Designing software without doing any exploratory
  22. programming often leads to poor designs requiring costly rework.
  23.  
  24. Compiling your code and linking it and zk together into a new zk.exe
  25. is an effective way to add new powerful features to zk.  You will
  26. probably want to compile and link repeatedly, as you add new features
  27. to zk and debug them.  To compile and link repeatedly, you need a
  28. makefile or batch file, to avoid typing the same commands repeatedly.
  29.  
  30. To get started writing your makefile or batch file, an example batch
  31. file, linkex.bat, is supplied, along with a corresponding example c++
  32. source file, linkex.zk, which gets compiled and linked with zk by
  33. linkex.bat to make a new zk.exe.  The first thing linkex.bat does is
  34. to use zk prep to preprocess linkex.zk to create linkex.cpp.  The
  35. filename extension ".zk" indicates that the language used is the zk
  36. extended version of c++, which gets converted to ordinary c++ in
  37. linkex.cpp.
  38.  
  39. You need to use zk prep even if you don't use the zk extensions to
  40. c++, because in addition to preprocessing the code, zk prep adds
  41. information which will be used when interpreted code calls compiled
  42. code.
  43.  
  44. If this sounds complicated, don't worry about it, just use linkex.bat
  45. and linkex.zk as described below, and it will soon seem trivial.
  46.  
  47. First, you might want to make a new directory where you will build
  48. your new version of zk.exe, and leave the old version where it is.
  49. The simplest way is to just copy all the files, *.*, from the old
  50. directory to the new one.  Go to that directory and edit linkex.zk,
  51. making a minor change to some of the text it outputs, so you will
  52. be able to see that the new version is your version.  Then run
  53. linkex.bat to build the new version, and when it's done, run it, by
  54. typing "zk" at the operating system command line, and then on the
  55. zk command line, type "linkex()" to call the linkex function, to
  56. see that the output is from the change you made.
  57.  
  58. Having successfully made a minor change to linkex.zk and seen it run,
  59. you are now ready to proceed with adding your own code.  First, decide
  60. whether you want to use more than one new source file, and whether you
  61. want to use a batch file like linkex.bat or a makefile.  Create your
  62. new batch file or makefile by copying the commands from linkex.bat and
  63. modifying them as needed, as indicated by the comments.  Or you can
  64. start more gradually, by gradually making changes to linkex.zk, to see
  65. each change work in zk.exe before proceeding, and then gradually add
  66. more source files, as explained in the comments in linkex.zk.
  67.  
  68.